//
//  XLMineTextTableViewCell.m
//  Mine
//
//  Created by 于鹏 on 2017/8/26.
//  Copyright © 2017年 YIVIEW. All rights reserved.
//

#import "XLMineTextTableViewCell.h"
#import "XLMineTextCellModel.h"
//#import <Masonry.h>
#import "Masonry.h"

@interface XLMineTextTableViewCell ()
@property (nonatomic, strong)XLCellLabel *detailLabel;
@end

@implementation XLMineTextTableViewCell

+ (XLBaseTableViewCell *)cellWithIdentifier:(NSString *)cellIdentifier tableView:(UITableView *)tableView {
    XLMineTextTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
    if (!cell) {
        cell = [[XLMineTextTableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
        //默认无选中效果
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
    }
    return cell;
}

- (void)setupUI {
    [super setupUI];
    [self.contentView addSubview:self.detailLabel];
    [self.detailLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.contentView).offset(0);
        make.right.equalTo(self.arrow.mas_left).offset(-XL_KArrowControlRightOffset);
    }];
}

- (void)setupDataModel:(XLBaseCellModel *)model {
 
    [super setupDataModel:model];
    XLMineTextCellModel *textModel = (XLMineTextCellModel *)model;
    self.detailLabel.text = textModel.detailText;
    self.detailLabel.textColor = textModel.detailColor;
    self.detailLabel.font = textModel.detailFont;
  
    
    if (!textModel.isShowArrow) {
        [self.detailLabel mas_remakeConstraints:^(MASConstraintMaker *make) {
            make.centerY.equalTo(self.contentView).offset(0);
            make.right.equalTo(self.contentView).offset(-XL_KControlRightOffset);

        }];

    } else {
        
    }
    
}

#pragma mark - Getter
- (XLCellLabel *)detailLabel {
    if (!_detailLabel ) {
        _detailLabel = [[XLCellLabel alloc]init];
        _detailLabel.textColor = XL_KTitleColor;
        _detailLabel.font = XL_KTitleFont;
    }
    return _detailLabel;
}
@end
